﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Drawing;

namespace ListaTelefonicaMEM.Controles
{


    class TextBoxNome : TextBoxPadrao
    {
        protected AutoCompleteStringCollection src = new AutoCompleteStringCollection();

        public void RefreshDataSource()
        {
            lt.Contatos.OrderBy(p => p.Nome);

            src.Clear();

            src.AddRange(lt.Contatos.Select(p => p.Nome).ToArray());
            this.AutoCompleteCustomSource = src;
            this.AutoCompleteSource = AutoCompleteSource.CustomSource;
            this.AutoCompleteMode = AutoCompleteMode.SuggestAppend;
        }
    }
}
